package naga.x.platform2.channel.egret.support;

public class AccountResponse extends Response {
	
	protected String msg; // if error
	protected Object data;

	protected AccountResponse() {
	}

	public AccountResponse(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public AccountResponse(int code, Object data) {
		this.code = code;
		this.data = data;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	public AccountResponse compatible() {
		if (code == ResponseCode.SUCC.code) {
			this.code = EgretApi.CODE_SUCC;
			this.msg = null;
		} else {
			this.code = EgretApi.CODE_ERROR;
			this.data = null;
		}
		return this;
	}
}
